{template "header.html"}

<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>

<script type="text/javascript">
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    orientation: "left",
                    autoclose: true
                });
            }
        });
    }
</script>
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache('tag', '');">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>
<div class="row table-search-tool">
    <form action="{SELF}" method="get">
        {dr_form_search_hidden(['pid'=>$pid])}
        <div class="col-md-12 col-sm-12">
            <label>
                <select name="field" class="form-control">
                    {loop $field $t}
                    {if $t.ismain}
                    <option value="{$t.fieldname}" {if $param.field==$t.fieldname}selected{/if}>{$t.name}</option>
                    {/if}
                    {/loop}
                </select>
            </label>
            <label><i class="fa fa-caret-right"></i></label>
            <label><input type="text" class="form-control" placeholder="" value="{$param['keyword']}" name="keyword" /></label>
        </div>

        <div class="col-md-12 col-sm-12">
            <button type="submit" class="btn green btn-sm onloading" name="submit" > <i class="fa fa-search"></i> {dr_lang('搜索')}</button>
        </div>

        {if $pid}
        <div class="col-md-12 col-sm-12" style="padding-top:2px">
            <a class="btn red btn-sm" href="{dr_url('tag/add', ['pid'=>$pid])}"> <i class="fa fa-plus"></i> {dr_lang('添加子词')}</a>
        </div>
        <div class="col-md-12 col-sm-12" style="padding-top:2px">
            <a class="btn blue btn-sm" href="{dr_url('tag/all_add', ['pid'=>$pid])}"> <i class="fa fa-plus"></i> {dr_lang('批量子词')}</a>
        </div>
        {/if}

    </form>
</div>


<form class="form-horizontal" role="form" id="myform">
    {dr_form_hidden()}
    <div class="table-scrollable">
        <table class="table table-striped table-bordered table-hover table-checkable dataTable">
            <thead>
            <tr class="heading">
                {if $ci->_is_admin_auth('del')}
                <th class="myselect">
                    <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                        <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                        <span></span>
                    </label>
                </th>
                {/if}
                <th style="text-align:center" width="70" class="{dr_sorting('displayorder')}" name="displayorder">{dr_lang('权重')}</th>
                <th width="250" class="{dr_sorting('name')}" name="name">{dr_lang('名称')}</th>
                <th width="200" class="{dr_sorting('code')}" name="code">{dr_lang('别名')}</th>
                <th width="100" class="{dr_sorting('hits')}" name="hits">{dr_lang('点击量')}</th>
                <th>{dr_lang('操作')}</th>
            </tr>
            </thead>
            <tbody>
            {loop $list $t}

            <tr class="odd gradeX" id="dr_row_{$t.id}">
                {if $ci->_is_admin_auth('del') || $ci->_is_admin_auth('edit')}
                <td class="myselect">
                    <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                        <input type="checkbox" class="checkboxes" name="ids[]" value="{$t.id}" />
                        <span></span>
                    </label>
                </td>
                {/if}
                <td style="text-align:center"> <input type="text" onblur="dr_ajax_save(this.value, '{dr_url('tag/order_edit', ['id'=>$t.id])}')" value="{$t.displayorder}" class="displayorder form-control input-sm input-inline input-mini"> </td>
                <td>{Function_list::title($t.name, $param, $t)}</td>
                <td>{$t.code}</td>
                <td>{$t.hits}</td>
                <td>
                    {if !$pid}
                    <label><a href="{dr_url('tag/index', ['pid'=>$t.id])}" class="btn btn-xs dark"> <i class="fa fa-tag"></i> {dr_lang('子词管理（%s）', $t.total)}</a></label>
                    {/if}
                    {if $ci->_is_admin_auth('edit')}
                    <label><a href="{dr_url('tag/edit', ['id'=>$t.id])}" class="btn btn-xs green"> <i class="fa fa-edit"></i> {dr_lang('修改')}</a></label>
                    {/if}
                </td>
            </tr>
            {/loop}
            </tbody>
        </table>
    </div>

         <div class="row fc-list-footer table-checkable ">
             <div class="col-md-5 fc-list-select">
                {if $ci->_is_admin_auth('del') || $ci->_is_admin_auth('edit')}
                <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                    <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                    <span></span>
                </label>
                <label><button type="button" onclick="dr_ajax_option('{dr_url($uriprefix.'/del')}', '{dr_lang('你确定要删除它们吗？')}', 1)" class="btn red btn-sm"> <i class="fa fa-trash"></i> {dr_lang('删除')}</button></label>
                {/if}
            </div>
             <div class="col-md-7 fc-list-page">
                 {$mypages}
             </div>
         </div>
</form>


{template "footer.html"}